home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 02 Useful Techniques / 07 Vykruta / MainFrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-11-21  |  2.4 KB  |  108 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "LOSGridDemo.h"
  6.  
  7. #include "MainFrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CMainFrame
  17.  
  18. IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd)
  19.  
  20. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  21.     //{{AFX_MSG_MAP(CMainFrame)
  22.     ON_WM_CREATE()
  23.     ON_WM_SETFOCUS()
  24.     ON_WM_MOUSEMOVE()
  25.     ON_WM_LBUTTONDOWN()
  26.     //}}AFX_MSG_MAP
  27. END_MESSAGE_MAP()
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CMainFrame construction/destruction
  31.  
  32. CMainFrame::CMainFrame()
  33. {
  34. }
  35.  
  36. CMainFrame::~CMainFrame()
  37. {
  38. }
  39.  
  40. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  41. {
  42.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  43.         return -1;
  44.     // create a view to occupy the client area of the frame
  45.     if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
  46.         CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
  47.     {
  48.         TRACE0("Failed to create view window\n");
  49.         return -1;
  50.     }
  51.     
  52.     // This isn't very friendly to small desktops.. but it does barely fit into 640x480
  53.     SetWindowPos(NULL,150,150,570,500,0);
  54.     
  55.     return 0;
  56. }
  57.  
  58. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  59. {
  60.     if( !CFrameWnd::PreCreateWindow(cs) )
  61.         return FALSE;
  62.     cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
  63.         ;
  64.  
  65.     cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
  66.     cs.lpszClass = AfxRegisterWndClass(0);
  67.     return TRUE;
  68. }
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CMainFrame diagnostics
  72.  
  73. #ifdef _DEBUG
  74. void CMainFrame::AssertValid() const
  75. {
  76.     CFrameWnd::AssertValid();
  77. }
  78.  
  79. void CMainFrame::Dump(CDumpContext& dc) const
  80. {
  81.     CFrameWnd::Dump(dc);
  82. }
  83.  
  84. #endif //_DEBUG
  85.  
  86. /////////////////////////////////////////////////////////////////////////////
  87. // CMainFrame message handlers
  88. void CMainFrame::OnSetFocus(CWnd* pOldWnd)
  89. {
  90.     // forward focus to the view window
  91.     m_wndView.SetFocus();
  92.     //SetCapture();
  93. }
  94.  
  95. void CMainFrame::OnMouseMove(UINT nFlags, CPoint point) 
  96. {
  97.     // TODO: Add your message handler code here and/or call default
  98.     
  99.     CFrameWnd::OnMouseMove(nFlags, point);
  100. }
  101.  
  102. void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point) 
  103. {
  104.     // TODO: Add your message handler code here and/or call default
  105.     
  106.     CFrameWnd::OnLButtonDown(nFlags, point);
  107. }
  108.